package com.atguigu.lease.common.springmvc;

import com.atguigu.lease.common.exception.LeaseException;
import com.atguigu.lease.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler(LeaseException.class)
    public Result error(LeaseException e) {
        e.printStackTrace();
        return Result.build(e.getCode(),e.getMessage());
    }
}
